<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
          Google Web Toolkit
          
            -
            CheckBox</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="../css/base.css" rel="stylesheet" type="text/css">
<link href="./doc.css" rel="stylesheet" type="text/css">
<link href="../css/print.css" rel="stylesheet" media="print" type="text/css">
</head>
<body>
<div id="gaia">&nbsp;</div>
<div id="header">
<div id="logo">
<a href="http://code.google.com/"><img src="http://code.google.com/images/code_sm.png" alt="Google"></a>
</div>
<div id="title">Google Web Toolkit (Beta)</div>
<div id="breadcrumbs">
<div id="nextprev">
<nobr><a href="com.google.gwt.user.client.ui.ChangeListenerCollection.html">&laquo; prev</a></nobr><nobr><a href="com.google.gwt.user.client.ui.ClickListenerCollection.html">next &raquo;</a></nobr>
</div>
<span class="item"><a href="http://code.google.com/">Google Code Home</a></span>
        &gt;
        <span class="item"><a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a></span>
        &gt;
        
        <span class="item"><a xmlns="" href="gwt.html">GWT Class Reference</a></span> &gt;
            <span class="item"><a href="com.google.gwt.user.client.ui.html">com.google.gwt.user.client.ui</a></span> &gt;
            <span class="selected item">CheckBox</span>
</div>
</div>
<div id="side">
<div id="menu">
<h4>
<a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a>
</h4>
<ul>
<li>
<a href="http://code.google.com/webtoolkit/download.html">Download GWT</a>
</li>
</ul>
<ul>
<li>
<a href="http://code.google.com/webtoolkit/overview.html">Product Overview</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/gettingstarted.html">Getting Started Guide</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/documentation/examples/">Example Projects</a>
</li>
</ul>
<ul>
<li>
<a href="./com.google.gwt.doc.DeveloperGuide.html">Developer Guide</a>
</li>
<li>
<a class="selected" href="./gwt.html">Class Reference</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/issues/">Issue Tracking</a>
</li>
<li>
<a href="http://groups.google.com/group/Google-Web-Toolkit">Developer Forum</a>
</li>
</ul>
<ul>
<li>
<a href="http://googlewebtoolkit.blogspot.com/">GWT Blog</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/faq.html">GWT FAQ</a>
</li>
<li>
<a href="http://code.google.com/webtoolkit/makinggwtbetter.html">Making GWT Better</a>
</li>
</ul>
<ul>
<li>
<a href="http://code.google.com/webtoolkit/thirdparty.html">Third Party Tools</a>
</li>
</ul>
</div>
<div id="search">
<form action="http://www.google.com/search" method="get">
<div>
<input name="domains" value="code.google.com" type="hidden"><input name="sitesearch" value="code.google.com" type="hidden">
<div class="header">Search this site:</div>
<div class="input">
<input name="q" size="10">
</div>
<div class="button">
<input value="Search" type="submit">
</div>
</div>
</form>
</div>
</div>
<div xmlns="http://www.w3.org/1999/xhtml" id="body">
<h1>Class CheckBox</h1>
<div class="classSig">public 
            class 
            CheckBox<br>extends
                <a xmlns="" href="com.google.gwt.user.client.ui.ButtonBase.html">ButtonBase</a>
<br>implements 
                <a href="com.google.gwt.user.client.ui.HasName.html">HasName</a>
<br>
<br>// Superclass of <code><a href="com.google.gwt.user.client.ui.RadioButton.html">RadioButton</a></code>
</div>A standard check box widget (also serves as a base class for
 <a href="com.google.gwt.user.client.ui.RadioButton.html">RadioButton</a>.
 <p>
<img class="gallery" src="CheckBox.png"></p>
<h3>CSS Style Rules</h3>
<ul class="css">
<li>.gwt-CheckBox { }</li>
</ul>
<p>
<h3>Example</h3>
<pre class="code">public class CheckBoxExample implements EntryPoint {

  public void onModuleLoad() {
    // Make a new check box, and select it by default.
    CheckBox cb = new CheckBox("Foo");
    cb.setChecked(true);

    // Hook up a listener to find out when it's clicked.
    cb.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        boolean checked = ((CheckBox) sender).isChecked();
        Window.alert("It is " + (checked ? "" : "not") + "checked");
      }
    });

    // Add it to the root panel.
    RootPanel.get().add(cb);
  }
}
</pre>
</p>
<h2 class="api">Constructors</h2>
<table cellpadding="1" cellspacing="1" class="members">
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#CheckBox()">CheckBox()</a></td><td>Creates a check box with no label. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#CheckBox(java.lang.String)">CheckBox(String)</a></td><td>Creates a check box with the specified text label. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#CheckBox(java.lang.String, boolean)">CheckBox(String, boolean)</a></td><td>Creates a check box with the specified text label. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#CheckBox(com.google.gwt.user.client.Element)">CheckBox(Element)</a></td><td></td>
</tr>
</table>
<h2 class="api">Methods</h2>
<table cellpadding="1" cellspacing="1" class="members">
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#getHTML()">getHTML()</a></td><td></td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#getName()">getName()</a></td><td>Gets the widget's name. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#getText()">getText()</a></td><td></td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#isChecked()">isChecked()</a></td><td>Determines whether this check box is currently checked. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#isEnabled()">isEnabled()</a></td><td>Gets whether this widget is enabled. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#onDetach()">onDetach()</a></td><td>This method is called when a widget is detached from the browser's
 document. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#setChecked(boolean)">setChecked(boolean)</a></td><td>Checks or unchecks this check box. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#setEnabled(boolean)">setEnabled(boolean)</a></td><td>Sets whether this widget is enabled. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#setFocus(boolean)">setFocus(boolean)</a></td><td></td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#setHTML(java.lang.String)">setHTML(String)</a></td><td></td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#setName(java.lang.String)">setName(String)</a></td><td>Sets the widget's name. </td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#setTabIndex(int)">setTabIndex(int)</a></td><td></td>
</tr>
<tr>
<td><a href="com.google.gwt.user.client.ui.CheckBox.html#setText(java.lang.String)">setText(String)</a></td><td></td>
</tr>
</table>
<h2 class="api">Constructor Detail</h2>
<a name="CheckBox()"></a>
<h3 class="api">CheckBox</h3>
<div class="memberSig">public <b> CheckBox</b>()</div>Creates a check box with no label.<hr>
<a name="CheckBox(java.lang.String)"></a>
<h3 class="api">CheckBox</h3>
<div class="memberSig">public <b> CheckBox</b>(<nobr><a href="java.lang.String.html">String</a> label</nobr>)</div>Creates a check box with the specified text label.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>label</dt>
<dd>the check box's label</dd>
</dl>
<hr>
<a name="CheckBox(java.lang.String, boolean)"></a>
<h3 class="api">CheckBox</h3>
<div class="memberSig">public <b> CheckBox</b>(<nobr><a href="java.lang.String.html">String</a> label, </nobr><nobr>boolean asHTML</nobr>)</div>Creates a check box with the specified text label.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>label</dt>
<dd>the check box's label</dd>
<dt>asHTML</dt>
<dd>
<code>true</code> to treat the specified label as html</dd>
</dl>
<hr>
<a name="CheckBox(com.google.gwt.user.client.Element)"></a>
<h3 class="api">CheckBox</h3>
<div class="memberSig">protected <b> CheckBox</b>(<nobr><a href="com.google.gwt.user.client.Element.html">Element</a> elem</nobr>)</div>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>elem</dt>
<dd>
<!--[Missing documentation]-->
</dd>
</dl>
<h2 class="api">Method Detail</h2>
<a name="getHTML()"></a>
<h3 class="api">getHTML</h3>
<div class="memberSig">public <a href="java.lang.String.html">String</a><b> getHTML</b>()</div>
<hr>
<a name="getName()"></a>
<h3 class="api">getName</h3>
<div class="memberSig">public <a href="java.lang.String.html">String</a><b> getName</b>()</div>Gets the widget's name.<h4 class="api">Return Value</h4>the widget's name<hr>
<a name="getText()"></a>
<h3 class="api">getText</h3>
<div class="memberSig">public <a href="java.lang.String.html">String</a><b> getText</b>()</div>
<hr>
<a name="isChecked()"></a>
<h3 class="api">isChecked</h3>
<div class="memberSig">public boolean<b> isChecked</b>()</div>Determines whether this check box is currently checked.<h4 class="api">Return Value</h4>
<code>true</code> if the check box is checked<hr>
<a name="isEnabled()"></a>
<h3 class="api">isEnabled</h3>
<div class="memberSig">public boolean<b> isEnabled</b>()</div>Gets whether this widget is enabled.<h4 class="api">Return Value</h4>
<code>true</code> if the widget is enabled<hr>
<a name="onDetach()"></a>
<h3 class="api">onDetach</h3>
<div class="memberSig">protected void<b> onDetach</b>()</div>This method is called when a widget is detached from the browser's
 document. Overridden because of IE bug that throws away checked state.<hr>
<a name="setChecked(boolean)"></a>
<h3 class="api">setChecked</h3>
<div class="memberSig">public void<b> setChecked</b>(<nobr>boolean checked</nobr>)</div>Checks or unchecks this check box.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>checked</dt>
<dd>
<code>true</code> to check the check box</dd>
</dl>
<hr>
<a name="setEnabled(boolean)"></a>
<h3 class="api">setEnabled</h3>
<div class="memberSig">public void<b> setEnabled</b>(<nobr>boolean enabled</nobr>)</div>Sets whether this widget is enabled.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>enabled</dt>
<dd>
<code>true</code> to enable the widget, <code>false</code>
          to disable it</dd>
</dl>
<hr>
<a name="setFocus(boolean)"></a>
<h3 class="api">setFocus</h3>
<div class="memberSig">public void<b> setFocus</b>(<nobr>boolean focused</nobr>)</div>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>focused</dt>
<dd>
<!--[Missing documentation]-->
</dd>
</dl>
<hr>
<a name="setHTML(java.lang.String)"></a>
<h3 class="api">setHTML</h3>
<div class="memberSig">public void<b> setHTML</b>(<nobr><a href="java.lang.String.html">String</a> html</nobr>)</div>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>html</dt>
<dd>
<!--[Missing documentation]-->
</dd>
</dl>
<hr>
<a name="setName(java.lang.String)"></a>
<h3 class="api">setName</h3>
<div class="memberSig">public void<b> setName</b>(<nobr><a href="java.lang.String.html">String</a> name</nobr>)</div>Sets the widget's name.<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>name</dt>
<dd>the widget's new name</dd>
</dl>
<hr>
<a name="setTabIndex(int)"></a>
<h3 class="api">setTabIndex</h3>
<div class="memberSig">public void<b> setTabIndex</b>(<nobr>int index</nobr>)</div>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>index</dt>
<dd>
<!--[Missing documentation]-->
</dd>
</dl>
<hr>
<a name="setText(java.lang.String)"></a>
<h3 class="api">setText</h3>
<div class="memberSig">public void<b> setText</b>(<nobr><a href="java.lang.String.html">String</a> text</nobr>)</div>
<h4 class="api">Parameters</h4>
<dl class="memberDetail">
<dt>text</dt>
<dd>
<!--[Missing documentation]-->
</dd>
</dl>
</div>
<div id="footer" xmlns="http://www.w3.org/1999/xhtml">
          &copy;2007 Google
          <span class="noprint">
            -
            <a href="http://www.google.com/">Google Home</a>
            -
            <a href="http://www.google.com/jobs/">We're Hiring</a>
            -
            <a href="http://www.google.com/privacy.html">Privacy Policy</a>
            -
            <a href="http://www.google.com/terms_of_service.html">Terms of Service</a>
            -
            <a href="mailto:code@google.com">Contact Us</a></span>
<div id="license" style="text-align: center; margin: 1em 0em 1em 0em">
            Except as otherwise
            <a href="http://code.google.com/policies.html#restrictions">noted</a>, the content of this  page is licensed under the  <a rel="license" href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>.
              <!--
            <rdf:RDF xmlns="http://web.resource.org/cc/">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by/2.5/"></license>
</Work>
<License rdf:about="http://creativecommons.org/licenses/by/2.5/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction"></permits>
<permits rdf:resource="http://web.resource.org/cc/Distribution"></permits>
<requires rdf:resource="http://web.resource.org/cc/Notice"></requires>
<requires rdf:resource="http://web.resource.org/cc/Attribution"></requires>
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"></permits>
</License>
</rdf:RDF>
              -->
            </div>
</div>
<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript" xmlns="http://www.w3.org/1999/xhtml"></script><script type="text/javascript">
          _uacct="UA-18071-1"; _uanchor=1; urchinTracker();
        </script>
</body>
</html>
